{extend name="public:base" /}

{block name="css"}
<link href="/static/laydate/theme/default/laydate.css">
{/block}

{block name="left_nav"}
<div class="lb-nav">
    <a href="{:url('studyLogList')}" class="lbn-btn">学习记录</a>
    <a href="javascript: void(0)" class="lbn-btn active">我的积分</a>
    <a href="{:url('errorTopicList')}" class="lbn-btn">错题本</a>
    <a href="{:url('weChatList')}" class="lbn-btn">微信讨论群</a>
</div>{/block}

{block name="main"}
<div class="mid-box" style="width: calc(100% - 300px);">

    <div class="mb-title">
        <div class="mbt-bt">我的积分</div>
        <div class="mbt-icon"><img src="__STATIC__/index/images/icon_jf.png"/></div>
        <div class="mbt-jf">{$user_integral}</div>
        <div class="mbt-r">
            <input type="text" class="mbtr-sj start_time screen-date" readonly placeholder="请选择开始时间" value="{:input('start_time')}">
            <div class="mbtr-z">～</div>
            <input type="text" class="mbtr-sj end_time screen-date" readonly placeholder="请选择结束时间" value="{:input('end_time')}">
            <button class="mbtr-btn">搜索</button>
            <div class="divclear"></div>
        </div>
        <div class="divclear"></div>
    </div>

    <div class="mb-table">

        <table width="100%" border="0">
            <thead>
            <tr>
                <th scope="col" width="20%">积分明细</th>
                <th scope="col" width="60%">增减说明</th>
                <th scope="col" width="20%">时间</th>
            </tr>
            </thead>
            <tbody>
            {volist name="list" id="vo"}
            <tr>
                <td>{$vo.type == 1 ? '+' : '-'}{$vo.integral}</td>
                <td>{$vo.msg}</td>
                <td>{$vo.create_time|timeFormat}</td>
            </tr>
            {/volist}
            </tbody>
        </table>

        <div id="page"></div>

    </div>

    {include file="public:footer" /}
</div>
{/block}

{block name="js"}
<script src="__STATIC__/index/js/renderPage.js"></script>
<script src="/static/laydate/laydate.js"></script>
<script>
    laydate.render({
        elem: '.screen-date' //指定元素
    });

    var all_page = parseInt(`{$all_page}`);
    renderPage(all_page)

    // 搜索
    $(document).on('click', '.mbtr-btn', function () {
        var start_time = $('.start_time').val();
        var end_time = $('.end_time').val();
        var url = '/index/Index/integralLogList';

        if (start_time) url += '/start_time/' + start_time;
        if (end_time) url += '/end_time/' + end_time;

        url += '.html';

        window.location.href = url;
    })
</script>
{/block}